var express = require('express');
var app = new express();

app.get('/list',function (req,res) {
    res.setHeader('Content-Type', 'text/plain;charset=utf8');
    let data = {
        code: 200,
        data: [{
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
        }, {
            date: '2016-05-04',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1517 弄'
        }, {
            date: '2016-05-01',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1519 弄'
        }, {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
        }]
    }
    setTimeout(()=>{
        res.end( JSON.stringify(data) )
    },2000)
})


var server = app.listen(3000, 'localhost', function (req, res, next) {
    var host = server.address().address
    var port = server.address().port
    console.log("http://%s:%s", host, port)
})